package com.chencs.common.menu.service;

import com.chencs.vo.common.grant.RoleModel;
import com.chencs.vo.common.menu.MenuModel;
import com.chencs.webmvc.rest.RestFullTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by fangzehua on 2017/6/15.
 */

@Service
public class MenuService {
    private static final Logger logger = LoggerFactory.getLogger(MenuService.class.getName());

    @Autowired
    RestFullTemplate restTemplate;
    /**标志远程服务url**/
    private static final String URLPATH = "service-common/menu/";

    public String getList() throws Exception{
        String ret = restTemplate.postForObject(URLPATH + "getList", String.class,"");
        logger.info("MenuService getList zuulGateWay result {}", ret);
        return ret;
    }


    public String addMenu(MenuModel menuModel) throws Exception{
        String ret = restTemplate.postForObject(URLPATH + "add", String.class,menuModel);
        logger.info("MenuService add zuulGateWay result {}", ret);
        return ret;
    }

    public String delete(MenuModel model) throws Exception{
        String ret = restTemplate.postForObject(URLPATH + "delete", String.class,model);
        logger.info("MenuService delete zuulGateWay result {}", ret);
        return ret;
    }
}
